package com.ywk.pattern._26_flyweight;

import java.util.Hashtable;

public class WebsiteFactory {
    private Hashtable flyweights = new Hashtable();

    public Website getWebsiteCategory(String key) {
        if (!flyweights.containsKey(key)) {
            flyweights.put(key, new ConcreteWebsite(key));
        }
        return (Website) flyweights.get(key);
    }

    public int getWebsiteCount() {
        return flyweights.size();
    }
}
